package com.pureut.quality.controller;

import com.pureut.common.core.web.controller.BaseController;
import com.pureut.common.core.web.domain.AjaxResult;
import com.pureut.common.log.annotation.Log;
import com.pureut.common.log.enums.BusinessType;
import com.pureut.quality.domain.vo.AddDocumentVo;
import com.pureut.quality.domain.vo.SampleAddVo;
import com.pureut.quality.service.QualitySampleInformationService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/***
 * 样品管理控制层
 * Author:C
 * Date:2023/02/07 10:30
 * @DESC
 */
@RestController
@RequestMapping("/quality-sample-information")
public class QualitySampleInformationController extends BaseController {

    @Resource
    QualitySampleInformationService qualitySampleInformationService;


    /**
     * 保存（样品信息）小保存
     */
    @PostMapping("/add")
    @Log(title = "保存（样品信息）", businessType = BusinessType.INSERT)
    public AjaxResult add(@RequestBody SampleAddVo sampleAddVo) {
        return toAjax(qualitySampleInformationService.add(sampleAddVo));
    }

    /**
     * 保存
     */
    @PostMapping("/addDocument")
    @Log(title = "保存", businessType = BusinessType.INSERT)
    public AjaxResult addDocument(@RequestBody AddDocumentVo addDocumentVo) {
        return toAjax(qualitySampleInformationService.addDocument(addDocumentVo));
    }

    /**
     * 样本信息列表
     */
    @GetMapping("/list")
    public AjaxResult getList(String inspectionSheetNo) {
        return AjaxResult.success(qualitySampleInformationService.getList(inspectionSheetNo));
    }
}
